//Entry.h
//Header file for Entry.cpp
//@author A0101038Y
//@class Entry
#ifndef ENTRY_H
#define ENTRY_H
#include <QtCore\Qdatetime.h>
#include <QString>
#include <CommonEnum.h>
#include <BotException.h>
using namespace std;
class Entry
{
protected:
	string _name;
	QDate _endDate;
	QTime _endTime;
	static const QString FORMAT_DATE;
	static const QString FORMAT_TIME;
	static const QDate EMPTY_DATE;
	static const QTime EMPTY_TIME;
	static const string EMPTY_STRING;
	static const string TYPE_EVENT;
	static const QString Entry::FORMAT_DATE_INPUT;
	string _entryType;
public:
	static const int NUM_ATTRIBUTES=3;

	//Constructor of Entry (from file and for new entry)
	Entry(string, string, string);
	Entry(string,QDate,QTime);
	Entry();
	
	//This is the deconstructor of Entry
	//pre-req: NIL
	//post-req: NIL
	~Entry(void);
	
	//This function gets the end date of an entry
	//pre-req: NIL
	//post-req: returns end date in Qdate format
	QDate getEndDate() const;
	
	//This function gets the end time of an entry
	//pre-req: NIL
	//post-req: returns end time in QTime format
	QTime getEndTime() const;
	
	//This function gets the name of an entry
	//pre-req: NIL
	//post-req: returns the name of an entry in string
	string getName() const;
	
	//This function sets the name of the Entry
	//pre-req: string of name
	//post-req: NIL
	void setName(string);
	
	virtual void setEndDate(QDate, CommonEnum::CALLER);
	virtual void setEndTime(QTime, CommonEnum::CALLER);
	
	//This function checks whether an Entry is empty
	//pre-req: NIL
	//post-req: returns boolean value
	bool isEmpty();
	
	//This function corrects the edit in end date or time
	//pre-req: caller identification (tokenizer or entries manager, old date, old time)
	//post-req: NIL
	void correctEndDateTimeValid(CommonEnum::CALLER, QDate, QTime);
	
	//This function checks the validity of start date and time < end date and time
	//pre-req: start and end date time in QDateTime format
	//post-req: returns boolean value
	bool isStartEndDateTimeValid(QDateTime, QDateTime);
	
	//This function reverts invalid change in End date or time
	//pre-req: old date, old time
	//post-req: NIL
	void revertInvalidEditDateTime(QDate, QTime);
	
	virtual bool isConflict(Entry*){return false;};
	virtual QDate getStartDate() const {return QDate();}
	virtual QTime getStartTime() const {return QTime();}
	virtual void setStartDate(QDate, CommonEnum::CALLER){return;}
	virtual void setStartTime(QTime, CommonEnum::CALLER) {return;}
	virtual string toString(){return "";}
	virtual bool operator==(Entry*) {return false;}
	virtual bool setDone() {return false;}
	virtual bool getStatus() const {return false;}
	virtual bool isFloat() const;
	virtual bool isSpanning() const;
	virtual bool isPast(QDateTime = QDateTime::currentDateTime()) const;
	virtual bool isOccuring(QDate = QDate::currentDate()) const;
	virtual string getStatusString() const {return "";}
	virtual string getEntryType() const {return "";}
	virtual string getSearchString() const {return "";}
	virtual int getAttributeCount() const {return 3;}
	virtual QDate getDate();
	virtual void setDefaultStartEndDateTime(){return;};
	virtual void revertEditEndDateEvent(QDate, QTime) {return;};
	virtual void changeDefaultToEndDateTimeEvent(QDate, QTime) {return;};
	virtual void completeMissingEndDateTimeAttributes() {return;};
	virtual void completeMissingStartDateTimeAttributes() {return;};
	virtual void setFloatStartDate(QDate, CommonEnum::CALLER) {return;};
	virtual void setFloatStartTime(QTime, CommonEnum::CALLER) {return;};
	virtual void setFloatEndDate(QDate, CommonEnum::CALLER) {return;};
	virtual void setFloatEndTime(QTime, CommonEnum::CALLER) {return;};
	virtual bool endToNewEndSmaller(int, int) {return false;};
	virtual bool newEndToEndSmaller(int, int) {return false;};
};

#endif